package ricm4.ep.tp3;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author fx
 */
public class Evenement {
	private int numTache;
        private E_Evt type;
        private double date;
	private double tempsDeService;
	
	public Evenement(int numTache, E_Evt type){
		this.numTache=numTache;
		this.type=type;
		this.date=0;
		this.tempsDeService=0;
	}
	
	public Evenement(int numTache, E_Evt type, double date, double tempsDeService){
		this.numTache=numTache;
		this.type=type;
		this.date=date;
		switch(this.type){
			case ARRIVE: 
			case FIN:
				this.tempsDeService=0;
				break;
			case DEBUT:
				this.tempsDeService=tempsDeService;
				break;
			default:;
		}
	}
	
	public int getNumTache(){
		return numTache;
	}
	
	public E_Evt getType(){
		return type;
	}
	
	public double getDate(){
		return date;
	}
	
	public void setDate(double date){
		this.date=date;
	}
	
	public double getTempsDeService(){
		return tempsDeService;
	}
	
	public void setTempsDeService(double temps){
		if(type==E_Evt.DEBUT) {
			tempsDeService=temps;
		}
	}
	
	@Override
	public String toString(){
		return "["+date+"]"+" Tache"+numTache+": "+type.name()+", duree "+tempsDeService;
	}
}
